function eleSend(mainWindow,ipcMain,event, params, timeout = 5000) {
    return new Promise((resolve, reject) => {
      let timeoutId;
      
      console.log(event)
      // 监听渲染进程的响应
      ipcMain.once(event+'-response', (event, status, response) => {
        console.log(event+'-response',111,timeoutId)
        clearTimeout(timeoutId); // 清除超时定时器
        if (status === 'success') {
          resolve(response);
        } else {
          reject(response);
        }
      });

        // 设置超时机制
        timeoutId = setTimeout(() => {
            console.log('error')
            reject(('Timeout: No response from renderer process'));
          }, timeout);

      // 发送消息给渲染进程
      mainWindow.webContents.send(event, params);
    });
  }

  module.exports = { eleSend };